<?php
/**
 * 依赖反转（委托），在a类中调用b类的方法
 * Created by PhpStorm.
 * User: Fitz
 * Date: 2018/8/15
 * Time: 16:14
 */

interface Employee
{
    public function work();
}

class Human implements Employee
{
    public function work()
    {
        // TODO: Implement work() method.
    }
}

class Robot implements Employee
{
    public function work()
    {
        // TODO: Implement work() method.
    }
}

class Manage
{
    private $employee;

    public function __construct(Employee $employee)
    {
        $this->employee = $employee;
    }

    public function manage()
    {
        $this->employee->work();
    }
}